package com.liu.backstage.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liu.backstage.mapper.UsersMapper;
import com.liu.backstage.model.Role;
import com.liu.backstage.model.Users;
import com.liu.backstage.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 腾杰说
 * @since 2020-07-08
 */
@Service
public class UsersServiceImpl extends ServiceImpl<UsersMapper, Users> implements UsersService {

    @Autowired
    private UsersMapper usersMapper;

    @Override
    public Users UserById(Integer id) {
        return usersMapper.UserById(id);
    }

    @Override
    public List<Role> userrole(Integer id) {
        return usersMapper.userrole(id);
    }

    @Override
    public void InserRole(Integer id, List<String> strings) {
        for (String string : strings) {
            usersMapper.insertRole(id,string);
        }
    }
}
